const express = require("express");
const router = express.Router();
const epidemic_situation_data = require("./../public/data/epidemic_situation");
const axios = require("axios");
router.get("/epidemic_situation",async (req,res)=>{
    try{
        const {data: resData} = await axios.get("https://oyen.api.storeapi.net/api/94/219?appid=15877&sign=3fedaa8ff5e1535dfd491a3a9a076bd0");
        if(resData.codeid == "10000")
        {
            console.log("网络接口资源");
            res.send(JSON.parse(JSON.stringify(resData).replace(/city/g,"xArea")));
        }
        else{
        
            res.send(JSON.parse(JSON.stringify(epidemic_situation_data).replace(/city/g,"xArea")));
        }
    }catch(err){
        console.log(err);
    }
})





module.exports = router;